#include "Gdi.h"

WINGDIAPI BOOL WINAPI AlphaBlend( __in HDC hdcDest, __in int xoriginDest, __in int yoriginDest, __in int wDest, __in int hDest, __in HDC hdcSrc, __in int xoriginSrc, __in int yoriginSrc, __in int wSrc, __in int hSrc, __in BLENDFUNCTION ftn);



BOOL AlphaBlendEx2(HDC hDC,CRect &rcDes, HBITMAP hBmp, CRect &rcSrc,BYTE alpha)
{
	BOOL bRet = FALSE;
	CDC dcTmp;
	dcTmp.CreateCompatibleDC(NULL);
	HBITMAP hOldBmp = dcTmp.SelectBitmap(hBmp);

//#ifndef UNDER_CE

	BLENDFUNCTION blender;
	blender.BlendOp = AC_SRC_OVER;
	blender.BlendFlags = 0;
	blender.SourceConstantAlpha = alpha;
	blender.AlphaFormat   =  0;

	bRet = ::AlphaBlend(hDC,rcDes.left,rcDes.top,rcDes.Width(),rcDes.Height(),dcTmp.m_hDC,
		rcSrc.left,rcSrc.top,rcSrc.Width(),rcSrc.Height(),blender);

//#endif

	dcTmp.SelectBitmap( hOldBmp );

	dcTmp.DeleteDC();

	return bRet;
}
